package com.careercup.question.id14952564;

import java.util.Scanner;
import java.util.Stack;

public class Solution {
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char c[] = in.nextLine().toCharArray();
		Stack<String> w = new Stack<String>();
		StringBuilder s = new StringBuilder();
		for(int i = 0; i < c.length; i++) {
			if(Character.isWhitespace(c[i])) {
				w.add(s.toString());
				s = new StringBuilder();
			}
			else
				s.append(c[i]);
		}
		w.add(s.toString());
		while(!w.isEmpty()) {
			System.out.print(w.pop());
			System.out.print(" ");
		}
		System.out.println();
	}
}
